package com.woniu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.entity.dto.TestScoreDTO;
import com.woniu.mapper.TestScoreMapper;
import com.woniu.service.TestScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScoreDTO> implements TestScoreService {
    @Autowired
    private TestScoreMapper testScoreMapper;


    //通过考试ID查询所有学生成绩
    @Override
    public PageInfo<TestScoreDTO> findAllBycontest(TestScoreDTO testScoreDTO) {
        //分页
        PageHelper.startPage(testScoreDTO.getPageNum(),testScoreDTO.getPageSize());
        List<TestScoreDTO> TestScore = testScoreMapper.findAllBycontest(testScoreDTO);
        return new PageInfo<>(TestScore);
    }
    //通过考试ID查询所有班级和战队
    @Override
    public List<String> findAllGroupByContestId(Integer contestId) {
        List<String> allGroup =testScoreMapper.findAllGroupByContestId(contestId);
        return allGroup;
    }
}
